/**
 * s字符串
 * m要替换的值
   n新值
 */
function replaceAll(s,m,n){
	return s.replace(new RegExp(m,'gm'),n);
}

/**
 * 获取图片的原始大小 取宽
 * @param img
 * @returns
 */
function getNaturalWidth(imgSrc) {
    var image = new Image();
    image.src = imgSrc;
    var naturalWidth = image.width
    return naturalWidth
}

/**
 * 获取图片的原始大小 取高
 * @param img
 * @returns
 */
function getNaturalHeight(imgSrc) {
    var image = new Image();
    image.src = imgSrc;
    var naturalHeight = image.height;
    return naturalHeight;
}


/**
 * 将毫秒数进行格式化
 * @param millisecondDate
 * @returns
 */
function formatByMillisecond(millisecondDate,pattern){
	if(millisecondDate==null){
		return "";
	}
	var date = new Date(millisecondDate);
	var dateTimeStr = date.getFullYear()+"-";
	var month = date.getMonth()+1;
	if(month<10){
		dateTimeStr+="0"+month+"-";
	}else{
		dateTimeStr+=month+"-";
	}
	
	var _date = date.getDate();
	if(_date<10){
		dateTimeStr+="0"+_date;
	}else{
		dateTimeStr+=_date;
	}
	
	if(pattern.indexOf("HH:mm:ss")>-1){
		if(date.getHours()<10){
			dateTimeStr+=" 0"+date.getHours()+":";
		} else{
			dateTimeStr+=" "+date.getHours()+":";
		}
		
		if(date.getMinutes()<10){
			dateTimeStr+="0"+date.getMinutes()+":";
		}else{
			dateTimeStr+=""+date.getMinutes()+":";
		}
		
		if(date.getSeconds()<10){
			dateTimeStr+="0"+date.getSeconds();
		}else{
			dateTimeStr+=date.getSeconds();
		}
	}
	return dateTimeStr;
} 
